package main

import (
	"algorithms/arrayGenerator"
	"algorithms/insertionSort"
	"algorithms/sortingHelper"
	"fmt"
	"log"
)

func main() {

	arr := []int{1, 4, 2, 3, 6, 5}
	arr1 := intArray{1, 4, 2, 3, 6, 5}
	arr0 := []Integer{1, 4, 2, 3, 6, 5, 5, 2, 4, 8, 23, 6, 2, 6, 34, 7, 2, 6, 8, 3, 1, 4}
	arr2 := []int{1, 4, 2, 3, 6, 5, 5, 2, 4, 8, 23, 6, 2, 6, 34, 7, 2, 6, 8, 3, 1, 4}
	arr3 := []int{1, 4, 2, 3, 6, 5, 5, 2, 4, 8, 23, 6, 2, 6, 34, 7, 2, 6, 8, 3, 1, 4}
	students0 := []student{
		{name: "Alice", score: 98},
		{name: "Bobo", score: 100},
		{name: "Charles", score: 66},
	}
	students1 := students{
		student: []student{
			{name: "Alice", score: 98},
			{name: "Bobo", score: 100},
			{name: "Charles", score: 66},
		},
	}

	insertionSort.Sort1(arr)
	insertionSort.Sort1(arr1)
	insertionSort.Sort(arr0)
	insertionSort.Sort3(arr2)
	insertionSort.Sort2(arr3)
	insertionSort.Sort(students0)
	insertionSort.Sort0(students1)

	fmt.Println(arr)
	fmt.Println(arr1)
	fmt.Println(arr0)
	fmt.Println(arr2)
	fmt.Println(arr3)
	fmt.Printf("%+v \n", students0)
	fmt.Printf("%+v \n", students1)

	// 性能测试
	dataSize := []int{10000, 100000}
	for _, n := range dataSize {
		arr4 := arrayGenerator.GenerateRandomArray(n, n)
		arr5 := make([]int, len(arr4))
		copy(arr5, arr4)
		err := sortingHelper.SortTest("InsertionSort0", 1, arr4)
		err = sortingHelper.SortTest("InsertionSort2", 1, arr5)
		if err != nil {
			log.Println(err)
		}
	}

}
